home *** CD-ROM | disk | FTP | other *** search
File List | 1986-10-19 | 9.3 KB | 343 lines |
- ' ****************
- ' *** TEXT.LST ***
- ' ****************
- '
- DEFWRD "a-z"
- '
- > PROCEDURE font.8x16
- ' *** 8x16 font (width 8 pixels, height 16 pixels) for PRINT-command
- ' *** equals DEFTEXT ,,,13 for TEXT-command
- ' *** this is the default system-font in High resolution
- ' *** uses/changes Standard Globals
- LOCAL a$,adr%
- a$=MKI$(&HA000)+MKI$(&H2009)+MKI$(&H4E75) ! MOVE.L A1,D0 RTS
- adr%=VARPTR(a$)
- adr%=C:adr%() ! address of font-table
- {INTIN}={adr%+8} ! pointer to 8x16 system-font (3rd pointer)
- VDISYS 5,2,0,102 ! Init System Font (VDI 5, Escape 102 ; undocumented ?)
- char.height=16
- scrn.lin.max=(scrn.y.max+1)/char.height
- RETURN
- ' ***
- > PROCEDURE font.8x8
- ' *** 8x8 font for PRINT-command
- ' *** equals DEFTEXT ,,,6 for TEXT-command
- ' *** this is the default system-font in Low and Medium resolution
- ' *** uses/changes Standard Globals
- LOCAL a$,adr%
- a$=MKI$(&HA000)+MKI$(&H2009)+MKI$(&H4E75) ! MOVE.L A1,D0 RTS
- adr%=VARPTR(a$)
- adr%=C:adr%() ! address of font-table
- {INTIN}={adr%+4} ! pointer to 8x8 system-font (2nd pointer)
- VDISYS 5,2,0,102 ! Init System Font (VDI 5, Escape 102 ; undocumented ?)
- char.height=8
- scrn.lin.max=(scrn.y.max+1)/char.height
- RETURN
- ' **********
- '
- > PROCEDURE change.font
- ' *** change PRINT-font for High resolution
- ' *** use A1_xxxxx.FON-files created with FONTKIT (by Jeremy Hughes)
- ' *** restore original system-font with @normal.font
- ' *** uses Standard Global
- ' *** global : NEW.FONT! NORMAL.FONT%
- LOCAL adr%,new.font%
- IF high.res!
- '
- ' *** load A1_xxxxx.INL file (4114 bytes) from FONTS-folder here
- ' *** any regular Atari-font (4096 bytes) can be loaded as well !
- INLINE new.font%,4114
- '
- adr%=L~A-22
- normal.font%={adr%}
- SLPOKE adr%,new.font%
- new.font!=TRUE
- ENDIF
- RETURN
- ' ***
- > PROCEDURE normal.font
- ' *** restore default system-font
- IF new.font!
- SLPOKE L~A-22,normal.font%
- new.font!=FALSE
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE scroll.print(txt$,col,lin,width)
- ' *** scroll text with PRINT in box (width in characters)
- ' *** quit after any keypress (complete string is printed before exit)
- ' *** uses Standard Global
- LOCAL a$,n,x1.box,y1.box,x2.box,y2.box
- x1.box=col*8-9
- y1.box=lin*char.height-(char.height+2)
- x2.box=x1.box+width*8+1
- y2.box=y1.box+char.height+3
- BOX x1.box,y1.box,x2.box,y2.box
- a$=SPACE$(width-1)+txt$+" "
- REPEAT
- UNTIL INKEY$=""
- REPEAT
- FOR n=1 TO LEN(a$)
- PRINT AT(col,lin);MID$(a$,n,width);
- PAUSE 7
- NEXT n
- UNTIL INKEY$<>""
- RETURN
- ' **********
- '
- > PROCEDURE scroll.text(txt$,x,y,w,h)
- ' *** scroll text with TEXT in box with width w pixels and height h pixels
- ' *** uses Procedure Set.clip.rectangle and Txt.extent
- ' *** also uses Procedure Initio.logical.screen etc.
- LOCAL txt.y,width,height,screen$,n,in$
- DEFFILL white,1
- BOX x,y,x+w,y+h
- CLIP x+1,y+1 TO x+w-1,y+h-1
- @text.extent(txt$,width,height)
- txt.y=y+(h-height)/2+height-2
- SGET screen$
- @initio.logical.screen
- CLS
- SPUT screen$
- REPEAT
- FOR n=x+w TO x-width STEP -2
- in$=INKEY$
- EXIT IF in$<>""
- TEXT n,txt.y,txt$
- @swap.screen
- PBOX x+1,y+1,x+w-1,y+h-1
- PAUSE 1
- NEXT n
- UNTIL in$<>""
- CLIP OFF
- @restore.physical.screen
- RETURN
- ' **********
- '
- > PROCEDURE sound.txt(txt$)
- ' *** play scale while text appears
- LOCAL octave,n
- octave=3
- FOR n=1 TO LEN(txt$)
- PRINT MID$(txt$,n,1);
- IF n MOD 12=0
- INC octave
- ENDIF
- SOUND 1,13,n MOD 12,octave,5
- NEXT n
- SOUND 1,0,0,0,0
- RETURN
- ' **********
- '
- > PROCEDURE bell.txt(txt$,number)
- ' *** flash text several times with bell-sound (at current cursor-position)
- LOCAL x,y,n
- x=CRSCOL
- y=CRSLIN
- FOR n=1 TO number
- PRINT AT(x,y);txt$;
- PRINT bel$;
- PAUSE 15
- PRINT AT(x,y);SPACE$(LEN(txt$));
- PAUSE 15
- NEXT n
- PRINT AT(x,y);txt$;
- RETURN
- ' **********
- '
- > PROCEDURE text.parameters(VAR color,attr,angle,height)
- ' *** text-parameters : color, attribute, angle, height (as in DEFTEXT)
- ' *** I can't find attribute with Intout + 10 (bug in GEM ?)
- DPOKE CONTRL,38
- DPOKE CONTRL+2,0
- DPOKE CONTRL+4,2
- DPOKE CONTRL+6,0
- DPOKE CONTRL+8,6
- VDISYS
- color=DPEEK(INTOUT+2)
- attr=WORD{L~A+90} ! find attribute somewhere else
- angle=DPEEK(INTOUT+4)
- height=DPEEK(PTSOUT+2)
- RETURN
- ' **********
- '
- > PROCEDURE text.extent(txt$,VAR width,height)
- ' *** calculate width and height of text-box (printed with TEXT)
- ' *** should make life easier if you want to enclose text in a rectangle
- ' *** you'll have to experiment a little, especially if angle <> 0
- ' *** uses Procedure Text.parameters to determine angle
- LOCAL l,l$,n,x1,y1,x2,y2,x3,y3,x4,y4,k,angle,b,h
- ~VQT_EXTENT(txt$,x1,y1,x2,y2,x3,y3,x4,y4)
- @text.parameters(k,angle,b,h)
- IF angle=0
- width=x2
- height=y3
- ELSE IF angle=900
- width=x1
- height=y2
- ELSE IF angle=1800
- width=x1
- height=y2
- ELSE IF angle=2700
- width=x3
- height=x4 ! bug in GEM (?) : y1,x4 and y4 wrong
- ENDIF ! (x4 and y4 are swapped)
- RETURN
- ' **********
- '
- > PROCEDURE shadow.box(x1,y1,x2,y2)
- ' *** box with shadow (looks nice around text)
- BOX x1,y1,x2,y2
- DEFLINE 1,3
- DRAW x1+3,y2+1 TO x2+2,y2+1 TO x2+2,y1+3
- RETURN
- ' **********
- '
- > PROCEDURE shadow.text(x,y,txt$)
- ' *** print large 'shadowed' text with TEXT
- ' *** use spaces between characters !
- ' *** uses Standard Globals
- GRAPHMODE 2
- DEFTEXT black,0,0,32
- TEXT x,y,txt$
- TEXT x+2,y,txt$
- FOR i=4 TO 6
- TEXT x+i,y+i,txt$
- NEXT i
- GRAPHMODE 3
- DEFTEXT white
- TEXT x+1,y+1,txt$
- GRAPHMODE 1
- DEFTEXT black
- RETURN
- ' **********
- '
- > PROCEDURE flash(x1,y1,x2,y2,n)
- ' *** flash rectangle (with text) n times
- LOCAL flash$,i
- GET x1,y1,x2,y2,flash$
- FOR i=1 TO n
- PUT x1,y1,flash$,12
- PAUSE 25
- PUT x1,y1,flash$
- PAUSE 25
- NEXT i
- RETURN
- ' **********
- '
- > PROCEDURE text.at(col,lin,txt$)
- ' *** equals PRINT AT if same font-size is used (DEFTEXT ,,,13 or 6)
- ' *** uses Standard Globals
- TEXT (col-1)*char.width,lin*char.height+3*high.res!+2*(NOT high.res!),txt$
- RETURN
- ' **********
- '
- > PROCEDURE scroll.text.up(begin,end)
- ' *** scroll lines (begin-end) 1 line up
- ' *** this is much faster than PRINTing the lines again after CLS
- ' *** uses Standard Globals
- LOCAL screen%,sx,sy,w,h,dx,dy
- IF begin>1 AND end>=begin
- screen%=XBIOS(3) ! logical screen
- sx=0
- sy=(begin-1)*char.height
- w=scrn.x.max
- h=(end-begin+1)*char.height
- dx=0
- dy=sy-char.height
- RC_COPY screen%,sx,sy,w,h TO screen%,dx,dy
- ELSE
- PRINT bel$;
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE scroll.text.down(begin,end)
- ' *** scroll lines begin-end 1 line down
- ' *** this is much faster than PRINTing the lines again after CLS
- ' *** uses Standard Globals
- LOCAL screen%,sx,sy,w,h,dx,dy
- IF end<scrn.lin.max AND end>=begin
- screen%=XBIOS(3) ! logical screen
- sx=0
- sy=(begin-1)*char.height
- w=scrn.x.max
- h=(end-begin+1)*char.height
- dx=0
- dy=sy+char.height
- RC_COPY screen%,sx,sy,w,h TO screen%,dx,dy
- ELSE
- PRINT bel$;
- ENDIF
- RETURN
- ' **********
- '
- > PROCEDURE box.text(x1,y1,x2,y2,txt$)
- ' *** print inverted text (default system-font) in a box with TEXT
- ' *** use (at least one) space as first and last character of txt$ !!
- ' *** High resolution only
- GRAPHMODE 1
- DEFFILL 1,2,8
- PBOX x1,y1,x2,y2
- COLOR 0
- BOX x1+1,y1+1,x2-1,y2-1
- DEFTEXT 1,0,0,13
- GRAPHMODE 3
- TEXT x1,y1+(y2-y1)/2+6,x2-x1,txt$
- GRAPHMODE 1
- RETURN
- ' **********
- '
- > PROCEDURE fast.print(line,txt$)
- ' *** PRINT txt$ at line (1-25); much faster than PRINT AT(1,line);txt$
- ' *** High-resolution only !!
- ' *** no VT52-commands (e.g. reverse text) possible !!
- ' *** length of txt$ must not exceed 80 characters !!
- ' *** replace length with MIN(LEN(txt$)-1,79) if larger length possible
- ' *** use XBIOS(3) instead of XBIOS(2) for (invisible) logical screen
- ' *** routine by Peter Schapermeier
- '
- ' *** load FASTPRT.INL (150 bytes) here
- INLINE fast.print%,150
- '
- VOID C:fast.print%(L:V:txt$,SUB(LEN(txt$),1),SUB(line,1),L:XBIOS(2))
- RETURN
- ' **********
- '
- > PROCEDURE initio.fastprint
- ' *** PRINT txt$, but much faster than PRINT AT(1,line);txt$
- ' *** High-resolution only !!
- ' *** no VT52-commands (e.g. reverse text) possible !!
- ' *** intitialize with @initio.fastprint, then use Procedure Fastprint
- ' *** routine by Peter Schapermeier, improved by Kees Roos
- '
- ' *** load FASTPRT2.INL (192 bytes) here
- INLINE fastprint%,192
- {fastprint%+2}={L~A-22} ! font-address
- {fastprint%+6}=XBIOS(2) ! use XBIOS(3) for (invisible) logical screen
- RETURN
- ' ***
- > PROCEDURE fastprint(col,lin,txt$)
- ~C:fastprint%(L:ARRPTR(txt$),W:col,lin)
- RETURN
- ' **********
- '
- > PROCEDURE nicebox.text(col,lin,txt$)
- ' *** print text with box at column,line with TEXT (8x16 system font)
- ' *** High resolution only
- LOCAL x1,y1,x2,y2,width
- x1=(col-1)*8-4
- y1=(lin-1)*16-2
- width=8*LEN(txt$)
- x2=x1+width+7
- y2=y1+16+3
- BOX x1,y1,x2,y2
- BOX x1-1,y1-1,x2+1,y2+1
- BOX x1-4,y1-4,x2+4,y2+4
- DEFTEXT black,0,0,13
- TEXT x1+4,y1+14,width,txt$
- RETURN
- ' **********
- '
-